package test.clone;

import java.util.Date;

public class User implements Cloneable {

	private String name;

	private int salary;

	private Date birthday;

	private Book book;

	public User() {
	}

	public User(String name, int salary, Date birthday) {
		super();
		this.name = name;
		this.salary = salary;
		this.birthday = birthday;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getSalary() {
		return salary;
	}

	public void setSalary(int salary) {
		this.salary = salary;
	}

	public Date getBirthday() {
		return birthday;
	}

	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}
	
	@Override
	protected User clone() throws CloneNotSupportedException {
		User u = (User) super.clone();
		//实现深度clone
		u.book = (Book) this.book.clone();
		return u;
	}

	public Book getBook() {
		return book;
	}

	public void setBook(Book book) {
		this.book = book;
	}

}
